local jw_chili = fk.CreateSkill {
    name = "jw_chili",
    anim_type = "offensive",
    tags = { Skill.Compulsory }
}
Fk:loadTranslationTable {
    ["jw_chili"] = "炽力",
    [":jw_chili"] = "锁定技，当你对其他角色造成伤害时，令其获得一枚“炽”，当时受到其他角色的伤害时，伤害来源获得一枚“炽”，至多三枚；" ..
        "你对有“炽”的角色使用【杀】无距离和次数限制，每回合首次使用牌指定其为目标时，摸其“炽”等量的牌，然后移去其一枚“炽”。",

    ["$jw_chili1"] = "巴中巴西，连战可得！",
    ["$jw_chili2"] = "先斩张儁乂，再下瓦口关！",

    ["@zhangfei_chi"] = "炽",
}
jw_chili:addEffect(fk.DamageCaused, {
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(jw_chili.name) and data.to and
            not data.to.dead and data.to ~= player and data.to:getMark("@zhangfei_chi") < 3 and
            data.skillName ~= "jw_yanwei"
    end,
    on_use = function(self, event, target, player, data)
        player.room:addPlayerMark(data.to, "@zhangfei_chi")
    end
})
jw_chili:addEffect(fk.DamageInflicted, {
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(jw_chili.name) and data.from and
            not data.from.dead and data.from ~= player and data.from:getMark("@zhangfei_chi") < 3
    end,
    on_use = function(self, event, target, player, data)
        player.room:addPlayerMark(data.from, "@zhangfei_chi")
    end
})
jw_chili:addEffect(fk.TargetSpecifying, {
    anim_type = "support",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(jw_chili.name) and data.card and target == player and
            data.to:getMark("@zhangfei_chi") ~= 0 and player:getMark("jw_chili-turn") == 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local x = data.to:getMark("@zhangfei_chi")
        player:drawCards(x, jw_chili.name)
        room:removePlayerMark(data.to, "@zhangfei_chi", 1)
        room:setPlayerMark(player, "jw_chili-turn", 1)
    end,
})
jw_chili:addEffect("targetmod", {
    bypass_times = function(self, player, skill, scope, card, to)
        return card and card.trueName == "slash" and player:hasSkill(jw_chili.name) and to and
            to:getMark("@zhangfei_chi") ~= 0
    end,
    bypass_distances = function(self, player, skill, card, to)
        return card and card.trueName == "slash" and player:hasSkill(jw_chili.name) and to and
            to:getMark("@zhangfei_chi") ~= 0
    end,
})
return jw_chili
